package com.example.crm.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.crm.entity.Account;
import com.example.crm.mapper.AccountMapper;
import com.example.crm.service.AccountManager;
import lombok.NonNull;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author ssc
 * @date 2021/12/10
 */
@Service
@Transactional
public class AccountManagerImpl extends ServiceImpl<AccountMapper, Account> implements AccountManager {


    @Override
    public Account getByUsername(@NonNull String username) {
        return baseMapper.selectOne(
                Wrappers.<Account>lambdaQuery()
                        .eq(Account::getUserName, username)
        );
    }
}
